
using UnityEngine;

namespace ABA
{
	public class Path_ProtoWin : IPathConfig, IEditorPrefs
	{
		private static string default_proto_folder => System.IO.Path.GetFullPath(Application.dataPath + "/../CombaProtobuf");
		private static string default_gen_csharp_folder => $"{Application.dataPath}/Scripts/Game/Data/Proto";


        #region 设置上的字段菜单

        [SettingProperty(FieldType.Folder, "Proto协议 目录: ")]
		public static string ProtoFolder
		{
			get { return EditorPrefsHelper.GetString("Path_ProtoWin_ProtoFolder", default_proto_folder); }
			set => EditorPrefsHelper.SetString("Path_ProtoWin_ProtoFolder", value);
		}

		[SettingProperty(FieldType.Folder, "Gen C#目录: ")]
		public static string GenCSharpFolder
		{
			get
			{
				return EditorPrefsHelper.GetString("Path_ProtoWin_GenCSharpFolder", default_gen_csharp_folder);
			}
			set => EditorPrefsHelper.SetString("Path_ProtoWin_GenCSharpFolder", value);
		}


		[SettingMethod("", "打开Proto工具")]
		public static void OpenProtoWinTool()
		{
			ProtoGenerateWin.ProtoWinTool();
		}
		#endregion

		#region IPathConfig,IEditorPrefs
		public const string TAG = "ProtoBuf";

		public string GetModuleName()
		{
			return TAG;
		}

		public void ReleaseEditorPrefs()
		{
			EditorPrefsHelper.DeleteKey("Path_ProtoWin_ProtoFolder");
			EditorPrefsHelper.DeleteKey("Path_ProtoWin_GenCSharpFolder");
		}

		#endregion
	}
}